using System;
using System.Data;
using System.Collections;

namespace APP.QUANLY.Entity
{
    /// <summary>
    /// Summary description for HOADONNHAPKHO.
    /// </summary>
    public class HOADONNHAPKHOList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public HOADONNHAPKHOList()
    	{
	    }

		public void Add(HOADONNHAPKHO entity)
		{
            this.List.Add(entity);
		}

		public void Add(HOADONNHAPKHOList list)
		{	
			foreach(HOADONNHAPKHO entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual HOADONNHAPKHO this[int index]
		{
		    get
			{
				return (HOADONNHAPKHO)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual HOADONNHAPKHO Find(string MAHOADONNHAP)
	{
	    foreach (HOADONNHAPKHO obj in this.List)
	    {
		if(obj.MAHOADONNHAP.ToString().ToUpper().Trim() == MAHOADONNHAP.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual HOADONNHAPKHOList FindListByMAHOADONNHAP(string MAHOADONNHAP)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
		    if(obj.MAHOADONNHAP.ToString().ToUpper().Trim() == MAHOADONNHAP.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual HOADONNHAPKHO FindByTHANHTIENCHUACK_HD(decimal THANHTIENCHUACK_HD)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.THANHTIENCHUACK_HD.ToString().ToUpper().Trim() == THANHTIENCHUACK_HD.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByCHIETKHAUTHEOTIEN_HD(decimal CHIETKHAUTHEOTIEN_HD)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.CHIETKHAUTHEOTIEN_HD.ToString().ToUpper().Trim() == CHIETKHAUTHEOTIEN_HD.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindBySOTIENTHANHTOAN_HD(decimal SOTIENTHANHTOAN_HD)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.SOTIENTHANHTOAN_HD.ToString().ToUpper().Trim() == SOTIENTHANHTOAN_HD.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindBySOTIENCHI(decimal SOTIENCHI)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.SOTIENCHI.ToString().ToUpper().Trim() == SOTIENCHI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByLOAIHOADON(Int32 LOAIHOADON)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.LOAIHOADON.ToString().ToUpper().Trim() == LOAIHOADON.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByHANTHANHTOAN(DateTime HANTHANHTOAN)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.HANTHANHTOAN.ToString().ToUpper().Trim() == HANTHANHTOAN.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByGHICHU_HD(string GHICHU_HD)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.GHICHU_HD.ToString().ToUpper().Trim() == GHICHU_HD.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByDATHANHTOAN(bool DATHANHTOAN)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.DATHANHTOAN.ToString().ToUpper().Trim() == DATHANHTOAN.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByNGUOITAO(string NGUOITAO)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.NGUOITAO.ToString().ToUpper().Trim() == NGUOITAO.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByNGAYTAOHOADON(DateTime NGAYTAOHOADON)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.NGAYTAOHOADON.ToString().ToUpper().Trim() == NGAYTAOHOADON.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByISDELETE(bool ISDELETE)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByMANHACUNGCAP(Int32 MANHACUNGCAP)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.MANHACUNGCAP.ToString().ToUpper().Trim() == MANHACUNGCAP.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual HOADONNHAPKHO FindByMACA(Int32 MACA)
        {
	        foreach (HOADONNHAPKHO obj in this.List)
	        {
		        if(obj.MACA.ToString().ToUpper().Trim() == MACA.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual HOADONNHAPKHOList FindListByTHANHTIENCHUACK_HD(decimal THANHTIENCHUACK_HD)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.THANHTIENCHUACK_HD.ToString().ToUpper().Trim() == THANHTIENCHUACK_HD.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByCHIETKHAUTHEOTIEN_HD(decimal CHIETKHAUTHEOTIEN_HD)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.CHIETKHAUTHEOTIEN_HD.ToString().ToUpper().Trim() == CHIETKHAUTHEOTIEN_HD.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListBySOTIENTHANHTOAN_HD(decimal SOTIENTHANHTOAN_HD)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.SOTIENTHANHTOAN_HD.ToString().ToUpper().Trim() == SOTIENTHANHTOAN_HD.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListBySOTIENCHI(decimal SOTIENCHI)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.SOTIENCHI.ToString().ToUpper().Trim() == SOTIENCHI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByLOAIHOADON(Int32 LOAIHOADON)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.LOAIHOADON.ToString().ToUpper().Trim() == LOAIHOADON.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByHANTHANHTOAN(DateTime HANTHANHTOAN)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.HANTHANHTOAN.ToString().ToUpper().Trim() == HANTHANHTOAN.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByGHICHU_HD(string GHICHU_HD)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.GHICHU_HD.ToString().ToUpper().Trim() == GHICHU_HD.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByDATHANHTOAN(bool DATHANHTOAN)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.DATHANHTOAN.ToString().ToUpper().Trim() == DATHANHTOAN.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByNGUOITAO(string NGUOITAO)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.NGUOITAO.ToString().ToUpper().Trim() == NGUOITAO.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByNGAYTAOHOADON(DateTime NGAYTAOHOADON)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.NGAYTAOHOADON.ToString().ToUpper().Trim() == NGAYTAOHOADON.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByISDELETE(bool ISDELETE)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByMANHACUNGCAP(Int32 MANHACUNGCAP)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.MANHACUNGCAP.ToString().ToUpper().Trim() == MANHACUNGCAP.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual HOADONNHAPKHOList FindListByMACA(Int32 MACA)
{
	try
	{
		HOADONNHAPKHOList List = new HOADONNHAPKHOList();
		foreach (HOADONNHAPKHO obj in this.List)
		{
			if(obj.MACA.ToString().ToUpper().Trim() == MACA.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(HOADONNHAPKHOList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public HOADONNHAPKHO Current
			{
				get
				{
					return (HOADONNHAPKHO)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (HOADONNHAPKHO)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}